package com.hazardSoft.eStore.entities;

import java.io.Serializable;
import java.sql.Date;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import com.hazardSoft.eStore.utils.QueryConstants;

@Entity
@NamedQueries({
	@NamedQuery(name = QueryConstants.QUERY_LIST_OFFERS, query = "FROM Offer o ORDER BY o.name ASC"),
	@NamedQuery(name = QueryConstants.QUERY_SEARCH_OFFER_BY_NAME, query = "FROM Offer ofr WHERE ofr.name=?1")
})
public class Offer implements Serializable {
	@Id
	private Integer id;

	@Lob
	private String name;

	@Lob
	private String description;

	@Lob
	private String conditions;

	private Integer porcentage;

	private Integer quantity;

	private Date startdate;

	private Date enddate;

	@ManyToOne
	@JoinColumn(name="offerType")
	private OfferType offertype;

//	@OneToMany(mappedBy="offer")
//	private Set<Product> productCollection;

	private static final long serialVersionUID = 1L;

	public Offer() {
		super();
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getConditions() {
		return this.conditions;
	}

	public void setConditions(String conditions) {
		this.conditions = conditions;
	}

	public Integer getPorcentage() {
		return this.porcentage;
	}

	public void setPorcentage(Integer porcentage) {
		this.porcentage = porcentage;
	}

	public Integer getQuantity() {
		return this.quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

	public Date getStartdate() {
		return this.startdate;
	}

	public void setStartdate(Date startdate) {
		this.startdate = startdate;
	}

	public Date getEnddate() {
		return this.enddate;
	}

	public void setEnddate(Date enddate) {
		this.enddate = enddate;
	}

	public OfferType getOffertype() {
		return this.offertype;
	}

	public void setOffertype(OfferType offertype) {
		this.offertype = offertype;
	}

//	public Set<Product> getProductCollection() {
//		return this.productCollection;
//	}
//
//	public void setProductCollection(Set<Product> productCollection) {
//		this.productCollection = productCollection;
//	}

}
